﻿using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Mt.Site.Core.Organizations.Posts
{
    //调整部门管理： 部门上绑定角色（之前系统中有，把页面迁过来）
    //          部门上新建职务（增删改查）
    //          部门上为人员设置职务
    public class Post : FullAuditedEntity<long>, IMayHaveTenant, IPassivable
    {
        public const int MaxDisplayNameLength = 64;
        public const int MaxShortNameLength = 32;

        [Required]
        [StringLength(MaxDisplayNameLength)]
        public string DisplayName { get; set; }

        [StringLength(MaxShortNameLength)]
        public string ShortName { get; set; }

        public int Order { get; set; }

        /// <summary>
        /// 所属部门
        /// </summary>
        public long OrganizationId { get; set; }

        public PostGroup PostLevel { get; set; }

        public bool DeputyPresiding { get; set; }

        /// <summary>
        /// 主管部门
        /// </summary>
        [ForeignKey("PostId")]
        public virtual ICollection<PostOrganization> PostOrganizations { get; set; }

        public int? TenantId { get; set; }

        public bool IsActive { get; set; }

        public string UnqiueName { get; set; }

        public Post()
        {
            UnqiueName = Guid.NewGuid().ToString();
        }
    }
}
